home *** CD-ROM | disk | FTP | other *** search
- Documentation for IMPACT Dynamics Simulator v2.1
-
- Copyright (c) 1993,1995 John Henckel
- Permission to use, copy, modify, distribute and sell this software
- and its documentation for any purpose is hereby granted without fee,
- provided that the above copyright notice appear in all copies.
- ----------------------------------------------------------------------------
- First let me introduce myself. I'm John Henckel (henckel@vnet.ibm.com).
- Currently, I work for IBM in Rochester, Minnesota as a computer programmer.
- I like to write fun DOS programs as a hobby, and this is one of them.
-
- Impact simulates the collision of 2-dimensional convex polygons with graphical
- animation. The equations for collision of irregularly shaped objects are
- taken from "Dynamics" by Pestel and Thomson, 1968. With the mouse, you can
- grab an object and drag it or throw it. You can stack objects on top of one
- another. You can design experiments interactively, or you can use a text
- editor to make scenario files. As you watch the bodies bouncing off each
- other and the the walls, you can get energy reports of the total rotational,
- translational, and potential energy. You can turn on trace and sound to see
- the amusing "kinetic artwork". You can set physical constants restitution
- (elasticity), gravity, air friction, and sliding friction. It works on CGA,
- EGA, VGA, or Hercules using Borland BGI. (Help text not readable on Hercules.)
- Recommended but not required: mouse and 286 or better.
-
- -----------------------------------------------------------------------------
- Tutorial
-
- Experiment 1: Kinetic doodling
- Start the program and type "a 2 3 4", this will create two tall tri-
- angles. Position the mouse in the middle of the screen and
- click button 1. The nearest triangle will move toward the mouse.
- Now hold down mouse buttons 1 and 2. All the triangles are drawn
- toward the mouse (but not as quickly). Press 't', now as the bodies
- move they leave a colorful design behind them. Press 't' to turn off
- trace, press 'c' to clear the screen. Press 'd' twice to delete the
- bodies.
-
- Experiment 2: Inclined plane
- Type "a 1 3 10 2" to make a long incline plane. Type "a 1" to make
- a little box. Type "g 5" to enable gravity. Type "r 0.5" to make
- things not so bouncy. Now using the mouse, pick up the little box
- and set it on the inclined plane. Then watch it slide down.
-
- The Impact program take one command line parameter which is the name
- of a scenario file. See notes below for the file format. Some
- scenario files are included in this package, for example, type
- impact exp1.dat
- to load experiment 1 scenario.
-
- ------------------------------------------------------------------------
- R E L E A S E N O T E S
- ------------------------------------------------------------------------
-
- 1.0 93/11/16 - John Henckel, first release
-
- Room for Improvement:
- * The program defines impact as whenever the corner of one body enters
- the interior of another body, or enters a wall. This sounds simple
- but it has many difficulties. (a) It is possible for two bodies to
- overlap, but neither has a corner inside the other, this is very
- common with triangles because of their sharp corners. (b) It is
- possible for two bodies to each have a corner in the other, in
- this case I pick one arbitrarily. (c) It is possible for a body to
- hit a wall or another body with two of its corners, in this case I
- choose one arbitrarily. There are certainly better ways to handle
- these cases.
- * When gravity is enabled, one would like to stack objects on top of
- one another. This doesn't work though because the acceleration
- of gravity is constant, but the acceleration of impact becomes zero
- as the bodies slow down. Thus, they slowly mush into each other.
- To fix this, I added the 'j' parm for center adjustment factor.
- If s=1.0, then after computing the acceleration of impact, the bodies
- are separated from each other so that they no longer overlap. This
- opens up another question: what direction should they be separated?
- I use the normal to the impact surface. This has the nice side-
- effect of simulating sliding. However, the sliding is only a program
- artifact and not based on physics theory.
- * The center adjustment algorithm sometimes fails because of choosing
- the wrong impact surface. When a body is moving quickly, the impact
- edge can be found by reversing the relative velocity of the corner.
- However, if a body is moving very slowly, instead I choose the
- edge nearest to the corner as the impact surface. Sometimes this is
- not right.
- * "Dynamics" mentions two possible assumptions regarding forces acting
- parallel to the plane of impact. One is that they cancel relative
- velocities, the other is that the forces are zero. I have implemented
- the later, i.e. the bodies are perfectly slippery during impact.
- * The so-called air friction is not very realistic. It is a simple
- constant deceleration v' = v * (1-f). It doesn't take into account
- the shape of the object for aerodynamics.
- * Sometimes, if things get moving too quickly, the program will go crazy
- and shapes will fly off the screen into never-land. When this happens
- a floating-point error usually halts the program in a few seconds.
- Type "mode co80" in DOS to fix the video mode.
- * If you try to recompile the source code, you may have some difficulty
- with the registerBGIdriver(). You need to run the BGIOBJ program
- and change the project options. Or if you prefer, I think you can just
- delete the line with the registerBGIdriver, just make sure EGAVGA.BGI
- is in the current directory at runtime.
-
- Acknowledgements:
- This program was developed using Borland Turbo C++ 3.0. The speed and
- versatility of the graphics of this program is a tribute to the talented
- programmers at Borland. Also their online help is fabulous.
- The equations for collision of irregularly shaped objects are taken from
- "Dynamics" by Pestel and Thomson, 1968, I haven't found such a detailed
- analysis of this problem in any other book.
-
- -------------------------------------------------------------------------
- 1.2 93/01/20 - Some improvements:
-
- * The collision algorithm has been substantially improved. The
- dynamics equations have not been changed, but the method of
- determining which body hit which. When a body hits a wall, the
- corner deepest in the wall is used for collision. When two bodies
- collide, all corners on both bodies are searched to find the one
- with the deepest penetration and it is used to compute collision.
- These two changes REALLY helped the stability of stacking objects.
- * I added sliding friction. When the velocity normal to impact
- between two bodies or a body and a wall is less than some threshold,
- then velocity is changed in each body parallel to the surface inversely
- proportional to mass to decreases the relative motion. Sliding
- friction is also important for stacking objects.
- * Now you can create scenario description files which can be loaded
- from the command line. Three scenario files are included in the
- package. The first line in the file contains 7 physical constants
- friction gravity center-adjust restitution trace-mode
- sliding-threshold sliding-friction
- these are all floats, except trace which is 0 or 1. The remaining
- lines have the same format as the interactive "a" command.
- count sides aspect-ratio radius color noise mass
- moment pos-x pos-y pos-a vel-x vel-y vel-a
- Trailing data may be omitted. If you specify 0 for color, mass,
- moment, then the program will generate reasonable values.
- Moment is actually I/m. Angular data is in radians. Be careful
- about large numbers, the program does very little checking.
- The virtual screen is 30 by 40, with origin in bottom left.
- * I added a new feature to get an ENERGY REPORT while the program
- is running. It is fun to watch angular, translational, and
- potential energy change while the total remains about the same.
- The total varies some, I think it is because of the center-adjust
- algorithm.
- * I changed air friction to be v' = v/(1+f*v) which seems more
- realistic.
- * I added some checks to catch things before they crash the
- machine. You still need to be careful not to set gravity too high.
-
- -------------------------------------------------------------------------
- 2.1 95/01/26 - Some improvements:
-
- * I added some performance timers and discovered that 60% of the time was
- spent drawing the screen border! So I fixed that.
- * I tried to add joints but did not succeed. You can try the joint.dat
- file and see. The rotational inertia is not conserved as the joint moves
- and the bounce is not correct when the limb hits a wall. You're welcome
- to try and fix it, I have decided to start over using a new design in c++,
- (someday). One note: in the joint file, if you make one part jointed to
- another, then its position and velocity are ignored. The position and
- velocity of the dependent part is based on the root part. The "root" and
- the "joint" parent part are not necessarily the same, in case you have
- an arm with several joints. I haven't tried this, though. The rest of
- the program works fine, only the joints are buggy.
- * I improved the help text, and other parts of the user interface.
- * Impact does not adjust itself to your CPU speed, it runs as fast as it
- can! If you have a screaming 90 MHz Pentium then you may need to adjust
- the sample files -- gravity and velocities. The faster your CPU, the
- smoother and more accurate the simulation.
-
- I do not want you to send me any money for this software, but I do like to
- get email. If you make any improvements, please send them to me. Thanks.
-
- Romans 9:19ff
- One of you will say to me: "Then why does God still blame us? For who resists
- his will?" But who are you, O man, to talk back to God? Shall what is formed
- say to him who formed it, "Why did you make me like this?" Does not the
- potter have the right to make out of the same lump of clay some pottery for
- noble purposes and some for common use? What if God, choosing to show his
- wrath and make his power known, bore with great patience the objects of his
- wrath--prepared for destruction? What if he did this to make the riches of
- his glory known to the objects of his mercy, whom he prepared in advance for
- glory--even us, whom he also called, not only from the Jews but also from the
- Gentiles?
-
- John Henckel henckel@vnet.ibm.com
-